﻿using System;

namespace RrslLite
{
    public abstract class BatchCall
    {
        public Guid CorrelationId { get; private set; }
        private readonly Action<BatchCall> _call;

        protected BatchCall(Action<BatchCall> call)
            : this(Guid.NewGuid(), call)
        {
        }

        protected BatchCall(Guid correlationId, Action<BatchCall> call)
        {
            CorrelationId = correlationId;
            _call = call;
        }

        public virtual void Call()
        {
            _call(this);
        }

        public abstract void Callback(object data);
    }
}